﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BOM.BaseData;
using BOM.PriceBill;
using System.IO;
using NPOI.HSSF.UserModel;
using BOM.SysAdmin;

namespace BOM
{
    public partial class MainUI : Form
    {
        private int childFormNumber = 0;

        public MainUI()
        {
            InitializeComponent();
     
        }
        public void checkLicense()
        {
          /*
            Boolean flag = LicenseCheck.checkSignature();
            if (flag == false)
            {
                DialogResult rt = MessageBox.Show("软件还未激活，是否要马上激活?", "认证激活", MessageBoxButtons.YesNo);
               if (rt == DialogResult.Yes)
               {
                   LicenseDlg dlg = new LicenseDlg();
                   dlg.ShowDialog();
                   flag = LicenseCheck.checkSignature();
                   if (flag == false)
                   {
                       this.Close();
                   }
               }
               else
                   this.Close();
            }
             */
        }
        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "窗口 " + childFormNumber++;
            childForm.Show();
        }

        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
            }
        }

        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CutToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

  

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void btnCustomer_Click(object sender, EventArgs e)
        {
            checkLicense();
            CustomerList customerListUI = new CustomerList();
            customerListUI.Show();
        }

        private void btnMaterial_Click(object sender, EventArgs e)
        {
            checkLicense();
            MaterialList materialListUI = new MaterialList();
            materialListUI.Show();
        }

        private void btnPriceBill_Click(object sender, EventArgs e)
        {
            checkLicense();
            PriceBillList priceBillList = new PriceBillList();
            priceBillList.Show();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void mLicense_Click(object sender, EventArgs e)
        {
            LicenseDlg dlg = new LicenseDlg();
            dlg.ShowDialog();
        }

        private void onLoad(object sender, EventArgs e)
        {
            
        }

        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void customerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            checkLicense();
            CustomerList customerListUI = new CustomerList();
            customerListUI.Show();
        }

        private void materialToolStripMenuItem_Click(object sender, EventArgs e)
        {
            checkLicense();
            MaterialList materialListUI = new MaterialList();
            materialListUI.Show();
        }

        private void priceBillToolStripMenuItem_Click(object sender, EventArgs e)
        {
            checkLicense();
            PriceBillList priceBillList = new PriceBillList();
            priceBillList.Show();
        }

        private void SysConfigToolStripMenuItem_Click(object sender, EventArgs e)
        {
            checkLicense();
            ParamList paramList = new ParamList();
            paramList.Show();
        }

        private void contactusToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnParam_Click(object sender, EventArgs e)
        {
            checkLicense();
            ParamList paramList = new ParamList();
            paramList.Show();
        }


 
    }
}
